package com.example.onlinemusic.controller;

import com.example.onlinemusic.common.R;
import com.example.onlinemusic.model.request.SongListRequest;
import com.example.onlinemusic.service.SongListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 歌单管理控制层
 */
@RestController
public class SongListController {

    @Autowired
    private SongListService songListService;

    /**
     * 查询歌单列表
     *
     * @return
     */
    @GetMapping("/songList")
    public R songList(@RequestParam(required = false) String style) {
        return songListService.songList(style);
    }

    /**
     * 添加歌单
     *
     * @param songListRequest
     * @return
     */
    @PostMapping("/songList/add")
    public R addSongList(@RequestBody SongListRequest songListRequest) {
        return songListService.addSongList(songListRequest);
    }

    /**
     * 更新歌单
     *
     * @param songListRequest
     * @return
     */
    @PostMapping("/songList/update")
    public R updateSongList(@RequestBody SongListRequest songListRequest) {
        return songListService.updateSongList(songListRequest);
    }

    /**
     * 删除歌单
     *
     * @param id
     * @return
     */
    @GetMapping("/songList/delete")
    public R deleteSongList(@RequestParam int id) {
        return songListService.deleteSongList(id);
    }

    /**
     * 根据title查询歌单信息
     *
     * @param
     * @return
     */
    @GetMapping("/songList/likeTitle/detail")
    public R likeTitle(@RequestParam String title) {
        return null;
    }
}
